package leetcode_2401_2500;

import java.util.List;

public class LeeCode_2432 {
    public static void main(String[] args) {
        System.out.println(hardestWorker(10, new int[][]{{0, 3}, {2, 5}, {0, 9}, {1, 15}}));
    }
    private static int hardestWorker(int n, int[][] logs) {
        int max = 0, ans = 0, pre = 0;
        for (int[] log : logs) {
            if (log[1] - pre > max){
                max = log[1] - pre;
                ans = log[0];
            }else if (log[1] - pre == max){
                ans = Math.min(ans, log[0]);
            }
            pre = log[1];
        }
        return ans;
    }
}
